template String|Function

    The template which renders the content of the badge.

    Example - string template

    Open In Dojo
    <button>Button <span id="badge"></span></button>
    <script>
        $('#badge').kendoBadge({
            data: {
                current: 2,
                total: 10
            },
            themeColor: 'primary',
            template: '#= current # of #= total #'
        });
    </script>

    Example - function template

    Open In Dojo
    <button>Button <span id="badge"></span></button>
    <script>
        $('#badge').kendoBadge({
            text: 1234,
            themeColor: 'primary',
            template: function() {
                var text = this.options.text;
                return text > 99 ? 'A lot' : text;
            }
        });
    </script>
    In this article